<template>
	<view>
		<view class="mt-5" v-if="u_loadmore">
			<u-loadmore status="loading" icon-type="circle" />
		</view>
		<view v-else>
			<view class="m-2 bg-white rounded-20">
				<view class="today_title px-3 py-2">
					<view class="d-flex j-sb pt">
						<view class="d-flex a-center">
							<view class="rounded-50 d-flex user_img j-center a-center">
								<u-icon name="account-fill" color="#ff6b69" size="30"></u-icon>
							</view>
							<view class="">{{confirm_detail.mobile}}</view>
						</view>
						<view class="">{{confirm_detail.label_order_status}}</view>
					</view>
					<view class="d-flex j-sb text-light-muted pt-2">
						<view class="">{{confirm_detail.formated_add_time}}</view>
						<view class="">{{confirm_detail.order_sn}}</view>
					</view>
				</view>
				<view class="p-3" v-for="(item,index) in confirm_detail.goods_items" :key="index">
					<view class="d-flex">
						<image class="today_hot" :src="item.img.url" mode=""></image>
						<view class="m-2">
							<view class="">{{item.name}}</view>
						</view>
					</view>
					<view class="py-1">
						<text>共{{item.goods_number}}件</text><text>合计:{{confirm_detail.formated_order_amount}}</text>
					</view>
				</view>
			</view>
			<view class="m-2 p-3 rounded-20 bg-white beizhu">
				<input type="text" value="" placeholder="请输入操作备注..." v-model="action_note" @input="action_note_input" />
			</view>
			<view class="bg-white py-2 w-100 position-fixed bottom-0 btn">
				<button type="warn" @click="confirm_payment">确定付款</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				confirm_detail:"",
				order_id:"", // 订单ID
				action_note:"", // 备注
				u_loadmore:true, // 加载中
			}
		},
		onLoad(e) {
			this.$H.post("admin/orders/detail",{id:e.order_id}).then(res=>{
				this.order_id=e.order_id
				this.confirm_detail=res.data
				this.u_loadmore=false 
			})
		},
		methods: {
			// 备注
			action_note_input(e){
				this.action_note=e.detail.value
			},
			// 确认付款
			confirm_payment(){
				this.$H.post("admin/order/operate/pay",{
					order_id:this.order_id,
					action_note:this.action_note,
					}).then(res=>{
					uni.navigateBack({
						delta:1
					})
				})
			}
		}
	}
</script>

<style>
	.user_img{
		width: 40upx;
		height: 40upx;
		background-color: #ffd1d0;
	}
	.today_title{
		background-color: #f6efef;
		border-radius: 20upx 20upx 0 0;
	}
	.today_hot{
		width: 150upx;
		height: 150upx;
	}
	.beizhu{
		height: 300upx;
	}
	.btn /deep/ button{
		width: 85%;
		font-weight: 700;
		border-radius: 50upx;
		background: linear-gradient(to right,#F31E3E,#FB4F37);
	}
</style>
